HHControls 2.0.25
Manual
© Hanke & Hörner OEG
Flemmingg. 13
A - 1190 Vienna/Austria
European Union
info@hhsoft.com
http://www.hhsoft.com
This manual may be freely copied. It may not be modified without explicit written permission of the Hanke & Hörner OEG, no matter if this is done mechanically, electronically or by any other means. The Hanke & Hörner OEG may not be liable to pay compensation for any direct or indirect damage caused by using the software described within this manual or by using the content of the manual itself, except damage with intent or damage due to negligence on the part of the Hanke & Hörner OEG and except any liability to pay compensation due to mandatory legal requirements. In any case the liability of the Hanke & Hörner OEG is limited to the amount you have paid for this product.
Contents:
Common properties for all HHControls
Specific HHTextBoxControl-Properties
Specific HHNumControl-Properties
Specific HHDateBox-Properties
Specific HHComboBox-Properties
EVENTS
Events Supported by the HHComboBox Control Only
Methods
Methods Implemented in the HHComboBox Control Only
What's New In Release 2.0.25? Fixed Bugs
Common properties for all HHControls
BackColor, ForeColor, DisabledColor, FocusColor, ErrorColor, WarningColor, UseWarningColor
All HH Controls share a smart validation and back color switching logic. First of all, you can define a focus color (default: light green) beside the normal back color. When the HH Control gets the focus, the background switches to this focus color automatically. Then you can define an special error color (default: light red). If the user is up to enter an improper value, the background changes to this error color immediately. Then you may define a special warning color (default: light yellow), if you like. This is the back color the control takes on, in case the user has entered an improper value and has left the control. You may activate and deactivate this "warning color behaviour" with the UseWarningColor property. If you disable a HH Control, the background changes to the "disabled color" you chose in the DisabledColor property (default: grey). So, in difference to the VB's standard TextBox control, the user will always know whether the control is disabled or not.
Setting |
Description |
Colors specified by using the color palette or by using the RGB or QBColor functions in code.
|
|
Colors specified by system color. The Windows operating environment substitutes the user's choices as specified in the control Panel settings. |
Setting |
Description |
false (default) |
Once the control lost the focus incorrect or missing mandatory user entries will not be indicated. |
true |
On lost focus the back color of the control is changed to the color defined in the WarningColor property when the user-entry is incorrect or missing. |
Defines whether the field’s data are optional or mandatory. Relevant for the Error- and Warning color properties.
Setting |
Description |
The user need not enter a text (or a date or a value). |
|
The back color changes to either ErrorColor (Control has the focus) or to WarningColor (Control lost the focus) when leaving the input area blank. |
This property is implemented for reasons of compatibility. This property is read only.
Setting |
Description |
Paints controls and forms without visual effects. |
|
1 - HH3D (default) |
Paints controls with three-dimensional effects. |
Returns or sets the border style of. In difference to VB's standard controls, this property can be set at run time and at design time.
Setting |
Description |
No border |
|
1 - Fixed Single (default) |
A single line is drawn around the control |
In difference to VB's standard controls, you may assign NULL values to the HH Controls. This is especially valuable if you are developing a database application. When you have assignet a NULL value to a HH Control, the NullToEmptyString property now determines, what you will get when reading out the control:
Setting |
Description |
The assigned NULL value may be read out as Null value unchanged |
|
true (default) |
The assigned NULL value is converted to an empty string (""). |
Setting |
Description |
No text is selected (highlighted) when the control gets the focus. |
|
All of the text is selected (highlighted) when the control gets the focus so that the user can overwrite the existing text right away. |
This property is implemented just for reasons of compatibility. It is read only.
That property works similar to the Enabled Property. When a control is locked it "locks" the keyboard but allows user mouse-clicks (an fires the proper events). When using with the HHCombobox the GoTo-Button is still working but the ArrowDown-Button is disabled.
Text
In difference to standard VB's controls, the Text property of the HH Controls accept and return NULL values as well. The string returned by the Text property always looks like the string displayed by the control. Therefore with the HHDateBox and the HHNumBox control, the string returned by the Text property always contains all chosen separators and with the HHTextBox and the HHComboBox, the string returned by the Text property includes leading spaces if the control has still the focus, even if the Trim property is set true.
ToolTipText (VBA: ControlTipText)
That property is a so-called ambient control, like the Height or the Width property. This means that it is provided by your development environment (e.g. Visual Basic), not by the control itself. However, we state this property here to point out that, in difference to other ActiveX controls, it should work perfectly with VB and VBA. You may assign your tool tip text at design time as well as at run time.
The following properties act the same like in the regular VB's TextBox control and need no further explanaition:
Specific HHTextBoxControl-Properties
Setting |
Description |
false (default) |
Upper and lowers cases will be displayed |
true |
Lower case letters will be automatically converted to upper case during the process of typing. |
Setting |
Description |
The first character can be both lower and upper case |
|
true (default) |
The first character will be immediately converted to upper case (e.g. name fields). |
Returns or sets a value indicating whether there is a maximum number of characters that can be entered in the TextBox control and, if so, specifies the maximum number of characters that can be entered.
SettingDescription |
|
Maximum number of characters. Default = 0 for no limit |
Returns or sets a value indicating whether the control can accept and display multiple lines of text. In difference to VB's standard controls, this property can be set at run time and at design time.
Setting |
Description |
false (default) |
Ignores carriage returns and restricts data to a single line. |
true |
Allows multiple lines of text |
Setting |
Description |
0 – None (default) |
No scroll bars. |
Displays a vertical scrollbar |
|
2 – horizontal |
|
3 – both |
Returns or sets a value indicating whether the characters typed by a user or placeholder characters are displayed in the control; returns or sets the character used as a placeholder.
Setting |
Description |
A string expression specifying the placeholder character. Default = "" (no placeholder) |
Returns or sets a value indicating whether characters typed by a user will be ignored.
Setting |
Description |
A string expression specifying the characters, which are locked for user entry. Default = "" (no locks) |
e.g.: MyHHTxtBox1.ForbiddenCharakters = "$%&!§"
This property is of use, for example, if you do not want the user to enter quote marks, because this would spoil your SQL query.
Setting |
Description |
Leading spaces are allowed. |
|
true (default) |
Removes leading spaces on lost focus. |
This property returns a "preview" of the text as it will be formatted on lost focus. One example for using this property will be the saving of the form’s data by a shortcut (Ctrl-S). The current control will not loose the focus, but the data should be save in correct (formatted) form.
Specific HHNumControl-Properties
Setting |
Description |
The minus-key ("-") will be ignored and the user can enter positive values only |
|
true (default) |
Negative values are allowed |
Setting |
Description |
No range checking . |
|
true (default) |
Checks if the typed value is within the correct range, using the SmallestValue. LargestValue, IncludeSmallestValue and the IncludeLargestValue Property |
Whether the set value is included in the range or not, is defined by the properties IncludeSmallestValue and IncludeLargestValue.
Setting |
Description |
Value |
IncludeSmallestValue, IncludeLargestValue
Setting |
Description |
The entered value must be smaller than LargestValue and larger than SmallestValue. |
|
true (default) |
The entered value must be smaller than or equal to the LargestValue and larger than or equal to the SmallestValue |
Returns or sets the character used for the decimal point ("." or ",")
Setting |
Description |
String(1) (default=",") |
Character used for decimal point. |
Returns or set whether the thousand-separator is displayed or not.
Setting |
Description |
false |
Display without separator (1000,00) |
true (default) |
Display with separator (1.000,00). The character used ("," or ".") depends on the chosen decimal-point character. |
Specifies the number of digits to the right of the decimal point
Setting |
Description |
Default = 2, Minimum = 0 (integer only) |
Specifies the number of digits to the left of the decimal point
Setting |
Description |
Default = 7, Minimum = 1 (At least a leading 0.) |
Returns and sets the current content of the HHNumBox as numeric value. In difference to this property, the Text property returns a string containing all chosen separators.
Setting |
Description |
Value |
CheckRange
Setting |
Description |
false |
No range checking . |
true (default) |
Checks if the typed value is within the correct range, using the SmallestValue. LargestValue, IncludeSmallestValue and the IncludeLargestValue Property |
SmallestValue, LargestValue
Whether the set value is included in the range or not, is defined by the properties IncludeSmallestValue and IncludeLargestValue.
Setting |
Description |
Date |
Date boundary of validation range in internal date format |
IncludeSmallestValue, IncludeLargestValue
Setting |
Description |
false |
The entered value must be smaller than LargestValue and larger than SmallestValue. |
true (default) |
The entered value must be smaller than or equal to the LargestValue and larger than or equal to the SmallestValue |
DateFormat
Sets and returns the date format as it is shown in the HHDateBox.
Setting |
Description |
0 – DMY |
(Default) Day-Month-Year (31.12.1997) |
1 - YMD |
Year-Month-Day (1997-12-31) |
2 - MDY |
Month-Day-Year (31/12/1997) |
Sets and returns the Date in the Day-Month-Year format, regardless of the displayed format.
Setting |
Description |
String(10) |
Date-String |
Sets and returns the Date in the Year-Month-Day format, regardless of the displayed format.
Setting |
Description |
String(10) |
Date-String |
Sets and returns the Date in the Month-Year-Day format, regardless of the displayed format.
Setting |
Description |
String(10) |
Date-String |
Sets and returns the Date in the internal date format (used for calculation with date values), regardless of the displayed format.
Setting |
Description |
date |
Internal date format |
Sets and returns the separator character for the displayed Day-Month-Year format.
Setting |
Description |
Srting(1) |
Default = "." |
Sets and returns the separator character for the displayed Year-Month-Day format.
Setting |
Description |
Srting(1) |
Default = "-" |
Sets and returns the separator character for the displayed Month-Year-Day format.
Setting |
Description |
Srting(1) |
Default = "/" |
Specific HHComboBox-Properties
Common properties
The following properties have the same functionality like the known VB's ListBox properties and need no further explanation:
DropDownStyle
Sets whether the HHComboBox acts like a regular drop-down-style combo box control or not. This setting is ignored if the HHComboBox is data bound.
Setting |
Description |
true |
the control acts like a regular drop-down-style combo box control |
false (default) |
the control shows the specific HHComboBoxControl behaviour. |
If you set this property to true, you may use the control you may use it similar to a standard VB dropdown style ComboBox. But even then you have a lot of advantages. Have you ever tried to use the Change event of VB's standard ComboBox control? Have you ever wondered why the Height property of VB's standard ComboBox control is read-only? Or do you find the way the VB's standard ComboBox ListClick event works puzzling? We do. And these are some reason why we have developed this control.
MustFitDataList
Sets whether the text in the control has to match with (at least) one item of the data list.
Setting |
Description |
true (default) |
The control will change the Background-Color to the Error-Color if no matching item is found (on lost focus). |
false |
There is no automatic searching for matches in the data list. (The user however can initiate a search by clicking the Down-Arrow Button or by pressing the enter key.) |
If you set this property to true, you may use this control as a kind of text box that checks the user's input automatically against your database. If you have assigned the proper values to the SqlQueryString property, to the Connection Property and to the DataField property (see all below), the control will automatically check the if there is an entry in the database matching the user's input. If so, the input is completed immediately as the control looses focus. Or, if the user has entered not enough characters, a dropdown list containing all matching database entries pops up immediately so that the user can select the appropriate input simply by the click of the mouse or by using his keyboard.
If you set this property to false, on the other hand, you may use this control as a kind of look-up text box. If you have assigned the proper values to the SqlQueryString property, to the Connection Property and to the DataField property (see all below), the control will not force the user to enter an appropriate value, but he or she may still click the dropdown button or press the enter key to see a list of all matching database entries or to have the input completed automatically.
Connection (only at run-time)
This property specifies the connection the control is working with. By assigning a connection instead of a recordset (like the regular bound controls) the HHComboBox is especially prepared for client-server applications. As the HHComboBox closes and opens a recordset just for a moment, it won’t make much row locking and recordset updating problems. You can assign DAO connections as well as RDO connections.
Setting |
Description |
Connection |
DAO-Connection |
RdoConnection |
RDO-Connection |
Example:
Dim MyEnvironment As rdoEnvironment
Dim MyConnection As rdoConnection
Set MyEnvironment = rdoEnvironments(0)
Set MyConnection = MyEnvironment.OpenConnection(ODBCSource, rdDriverNoPrompt, False, ConnectString)
Set HHComboBox.Connection = MyConnection
Or
Dim MyWrkSpace As Workspace
Dim MyDb As Database
Set MyWrkSpace = CreateWorkspace("", "Admin", "", dbUseJet)
Set MyDb = MyWrkSpace .OpenDatabase("c:\temp\TestDB.mdb")
Set ComboTest.Connection = MyDb
SqlQueryString
Specifies the source of the records using the SQL-Syntax. The Syntax depends on the connection type used (DAO or RDO). The keyword "{DataField}" is a placeholder for the text entered in the TextBox. Use it in your SQL-Query to have the control dynamically searching only the records matching the text.
Setting |
Description |
string |
Containing the SQL-Query in the correct syntax. |
Example:
HHComboBox.SqlQueryString =
"SELECT ID, Name FROM People WHERE Name LIKE '{DataField}%' ORDER BY Name
DataField
Sets the field of the SQL-Query to be displayed in the list. As the SQL-Query can contain several fields (which can be read out separately by the "Item"-property) it is necessary to tell the HHComboBox which one to use for filling the list.
Setting |
Description |
string |
Containing the name of the field used in the SQL-Query |
Example:
MyHHComb.SQLQueryString = "SELECT LastName, FirstName, Age, ID FROM People WHERE LastName LIKE '{DataField}%' ORDER BY LastName"
MyHHComb.DataField = "LastName"
DataIdField
Sets the field of the SQL-Query to be used as the unique identifier. This property is optional, you do not need to declare an ID Field.
Setting |
Description |
string |
Containing the name of the field used in the SQL-Query |
Example:
MyHHComb.SQLQueryString = "SELECT LastName, FirstName, Age, ID FROM People WHERE LastName LIKE '{DataField}%' ORDER BY LastName"
MyHHComb.DataField = "ID"
ConnectionLockType
Sets the locking type for the internally used recordset or resultset. Use –1 for the default locktype (rdOpenForwardOnly and dbOpenForwardOnly). See DAO- or RDO-Reference for further details.
ConnectionOption
Specifies the option parameters used for opening the recordset. Use (–1) for the default value "ReadOnly". See DAO- or RDO-Reference for further details. (OpenResultset Method)
Button1Visible
Returns or sets a value indicating whether the down-arrow button of the HHComboBox is visible or hidden
Setting |
Description |
true (default) |
Displays the Down-Arrow Button |
false |
Hides the Down-Arrow Button |
The Down-Arrow Button works similar to the regular VB's ComboBox control. The user types several characters and when clicking the Down-Arrow the Control either completes the input or drops down a list with al matching words (assumed that you have entered the right SQL query using the {DataField} placeholder). If you make the arrow-button invisible the control is still fully functioning. It checks the input on lost focus (if the MustFitDataList is set true), and the user may initiate a database serch by pressing the enter key.
Button2Visible
The "..."-button ("Goto-Button") is a special feature of the HHComboBox for letting the user change quickly between different Data-Forms. For example if your application is about writing invoices, it requires the user to first select a customer. Getting the Customer’s name the user might realize a misspelling of the name. By clicking the Goto-Button the user can quickly switch to the customer’s personal data form and correct the mistake. It’s up to the programmer to use this feature (by adding code to the Button2_Click event). Experiences shows that it enhances the user friendliness a lot
Setting |
Description |
true (default) |
Displays the "..."-Button |
false |
Hides the "..."-Button |
MinLen
Sets or returns the amount of characters to be typed before the user can "open" the data list. By assigning a value of 2 the user is forced to specify the records to be obtained by the first two characters which for example avoids thousands of records passing the net.
Setting |
Description |
string |
Containing the name of the field used in the SQL-Query |
Item
Returns or sets the value of a specific column of an item. The syntax is:
Item(Column Name or Index, optional Item Index)
Parameter |
Description |
Column Name or Index |
Name or Index of a field in the SQL-Query |
Item Index |
Item index in the data list, starting with 0. If you leave out the item index, the the item index of the current item is being used. |
Example:
MyHHComb.SQLQueryString = "SELECT Name, Birthplace, ID FROM Workers"
MyHHComb.DataField = "Name"
MyHHComb.DataIDField = "ID"
Txt = MyHHComb.Item("Birthplace", MyHHComb.ListIndex)
Or
Txt = MyHHComb.Item("Birthplace")Or
Txt = MyHHComb.Item(2)
Returns the place of birth of the currently selected worker. IF you want to change the place of birth, simply write:
MyHHComb.Item("Birthplace")="New York" If there has been no column "Brithplace" so far, it will be created by the control immediately.
ValidationCheck (ValueOkay As Boolean)
This event belongs to all of the HHControls. Whenever the controls validates the user entries ("MustHaveValue", "ValidationRange", etc.) the event is fired and ValueOkay contains the result of the validation so far as boolean. You can add additional validation code or simply overwrite the validation result.
Example:
Private Sub MyHHControl_ValidationCheck(ValueOkay As Boolean)
ValueOkay = ValueOkay AND MyOwnAdditionalValidationFunction()
End Sub
Events Supported by the HHComboBox Control Only:
DropDown()
This event is fired after the data list has been opened.
Button1Click()
This event is fired whenever the user clicks the control's dropdown-button
Button2Click()
This event is fired, whenever the user clicks the control's "..."-button
ItemFound()
This event is fired whenever the user selects an existing item of the data list by typing a matching word, clicking on a specific item in the list or browsing the list with the arrow keys. Iwhen this event has been fired, you can be sure that the control's Index property holds a non-negative value.
ItemNotFound()
This event is fired whenever a searching process had been started, but no matching item was found. The control's Index property now holds "-1" as value.
ListClick()
This Event is similar to the ItemFound() event but is not fired when the user browses the data list. In other word it is only fired when the user completed his selection by clicking on an item, pressing the enter key or leaving the control after having entered a significant input.
CheckValueNow() as boolean
This method belongs to all of the HHControls. It forces a validation of the control 's data ("MustHaveValue", "ValidationRange", etc.) and returns the result as boolean. As the validation is normally triggered by the Lost Focus event this method is necessary whenever a validation is needed without leaving the control (e.g. the user wants to save the form’s data by using the shortcut Ctrl-S, thereby not leaving the control)
FormatText()
Implemented in: HHTextBox and HHComboBox. This method forces an immediate formatting of the text as it is normally done when loosing the focus.
Methods Implemented in the HHComboBox Control Only:
AddItem (Itemtext, Index)
This method adds an item to the control
Syntax:
MyHHComboBox.AddItem item, index
item: Required. string expression specifying the item to add to the object.
index: Optional. Integer specifying the position within the object where the new item or row is placed. For the first item, index is 0.
Clear()
This method clears the contents and all the list entries of the control. This may be valuable if you run out of memory.
CompleteNow()
When you call this method, the control tries to complete the input. If the input is ambiguous, the control drops a listbox. However, if the listbox has been already dropped when you called this method, the control takes the currently selected item.
RemoveItem (Index as integer)
Removes an item from the list.
Syntax
MyHHControl.RemoveItem index
index: Required. Integer representing the position within the object of the item or row to remove. For the first item, index = 0.
FindItem (SearchValue As Variant, SearchItem As SearchItemEnum, Optional MatchMode As MatchModeEnum)
Manually starts the searching for an item in the data list.
Parameter |
Description |
SearchValue |
Integer or String value of the item to be found (e.g. "Smith", 52) |
SearchItem |
Specifies whether to search for the DataField or the DataIDField
|
MatchMode |
|
SetItem(New_Text As Variant, New_ItemData As Long)
This method is a short representation of the following code sequence:
MyHhBox.Clear
MyHhBox.AddItem(New_Text)
MyHhBox.Item(MyHhBox.NewIndex)=New_ItemData
We implemented this method for the following reason: In a database application you may often think of the HHComboBox control more as a special data retrieving text box than a combo box. If you have, let's say, a HHComboBox control for entering a customer's name, under normal circumstances this control will hold the name of exactly one customer and it's ID. Just when the user wants to change this entry, a list may be build up by the control, but this is just to make it easy for the user to find the right customer. Your program is just interested in the specific customer the user has selected after all. So, for example, if the user loads an invoice of a customer, you want to fill the HHComboBox with this customer only. You, the programmer, are not interested in all the list box stuff at this point. You simply want to assign the customer's name an his ID to the control. And that is exactly what this method does.